/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.templates.RobotMap;
import edu.wpi.first.wpilibj.templates.commands.BridgeArmStop;

/**
 *
 * @author q
 */
public class BridgeArm extends Subsystem {
    // Put methods for controlling this subsystem
    // here. Call these from Commands.
    
    private Victor bridgeArm_Vic;
    
    public BridgeArm() {
        super("BridgeArm");
        
        bridgeArm_Vic = new Victor(RobotMap.BRIDGE_ARM);
        
    }

    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        setDefaultCommand(new BridgeArmStop());
    }
    
    public void bridgeArmStop() {
        bridgeArm_Vic.set(0.0);
    }
    
    public void raiseArm() {
        int flipped = 1;
        if (RobotMap.BRIDGE_PUSHER_REVERSED) {
            flipped = -1;
        }
        bridgeArm_Vic.set((RobotMap.BRIDGE_ARM_SPEED * flipped));
    }
    
    public void lowerArm() {
        int flipped = 1;
        if (RobotMap.BRIDGE_PUSHER_REVERSED) {
            flipped = -1;
        }
        bridgeArm_Vic.set(-(RobotMap.BRIDGE_ARM_SPEED * flipped));
    }
       
    public void setSpeed(double speed) {
        int flipped = 1;
        
        if (RobotMap.BRIDGE_PUSHER_REVERSED) {
            flipped = -1;
        }
        bridgeArm_Vic.set(1.0 * flipped);
    }
}
